package com.yj.timecapsule.controller.likes;

import com.yj.timecapsule.common.response.CommonResponseType;
import com.yj.timecapsule.service.likes.LikesService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author Sean
 * @CreateTime 2024-08-03  15:57
 * @Description
 * @Version 1.0
 */
@RestController
@RequestMapping("/likes")
public class LikesController {
    @Resource
    private LikesService likesService;

    @GetMapping("/assert-likes")
    public CommonResponseType<Map<Long,Boolean>> assertLikes(@RequestParam("diaryIds") List<Long> diaryIds) {
        Map<Long,Boolean> result = likesService.assertLikes(diaryIds);
        return CommonResponseType.success(result);
    }
    @PostMapping
    public CommonResponseType<Object> like(@RequestParam("diaryId") Long diaryId) {
        likesService.like(diaryId);
        return CommonResponseType.success();
    }
}
